<?php
/**
 *
 */
class Yz_Template_Layout
    extends Yz_Template_Native
    implements Yz_Template_Interface,Yz_Template_Layout_Interface
{

    protected $contentTemplate;
    protected $content;


    public function assignContent( Yz_Template_Interface $contentTemplate )
    {
        $this->contentTemplate = $contentTemplate;
        return $this;
    }

    /** Render the layout with the $contentTemplate as content
     *  @param Yz_Template_Interface $contentTemplate
     *  @return string
     */
    public function render()
    {
        debug();

        $contentTemplate = $this->contentTemplate;

        $this->value = $contentTemplate->toArray();

        // render the template in case it has not been rendered yet
        $this->content = $contentTemplate->render();

        // take the page head entries from the template AFTER render
        $this->css = $contentTemplate->getCSS();
        $this->js = $contentTemplate->getJS();
        $this->meta = $contentTemplate->getMeta();
        $this->title = $contentTemplate->getTitle();

        return $this->doRender();

        /// ###
        $content = $this->doRender();

        return $content;
    }


}
